package com.atm.controller;

import com.atm.annotation.NeedLogin;
import com.atm.entity.Account;
import com.atm.service.AccountService;
import com.atm.utils.result.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@RestController
public class BalanceController {

    @Resource
    private AccountService accountService;

    @ApiOperation("余额")
    @NeedLogin
    @PostMapping("/balance")
    public Result<Account> balance(HttpServletRequest httpServletRequest){
        return accountService.balance(httpServletRequest.getAttribute("accountNo").toString());
    }

}
